package com.example.lotteryticketdev.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("_table_lucky_ball")
public class LuckyBall extends BaseEntity{

    //蓝色球
    private String blue;

    //期号
    private String code;

    //中奖地区
    private String content;

    //其他信息
    private String msg;

    //开奖日期
    private String date;

    //细节页面连接地址
    @TableField(value = "details_link")
    private String detailsLink;

    //彩票名字
    private String name;

    //奖池金额
    @TableField(value = "pool_money")
    private BigDecimal poolmoney;

    //红色球
    private String red;

    //销售额
    private String sales;

    //视频地址
    @TableField(value = "video_link")
    private String videoLink;

    //星期
    private String week;


    //奖品等级
    @JSONField(name = "prizegrades")
    @TableField(exist = false)
    private List<Prize> prizes;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof LuckyBall)) return false;
        if (!super.equals(o)) return false;
        LuckyBall luckyBall = (LuckyBall) o;
        return Objects.equals(getBlue(), luckyBall.getBlue()) && Objects.equals(getCode(), luckyBall.getCode()) && Objects.equals(getRed(), luckyBall.getRed());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), getBlue(), getCode(), getRed());
    }
}
